package com.kepler.social.common.constants;

public enum MediaType {
    image(1, "图片"),
    video(2, "视频"),
    audio(3, "音频"),
    ;

    public int code;
    public String name;

    MediaType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static boolean exists(int code) {
        return null != getByType(code);
    }

    public static MediaType getByType(int code) {
        for (MediaType enum_ : values()) {
            if (enum_.getCode() == code) {
                return enum_;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

}
